<template>
  <div class="item">
    <div class="icon-container">
      <div class="icon-glow"></div>
      <i>
        <slot name="icon"></slot>
      </i>
    </div>
    <div class="details">
      <h3 class="hacker-title">
        <slot name="heading"></slot>
      </h3>
      <div class="content">
        <slot></slot>
      </div>
    </div>
    <!-- 装饰线 -->
    <div class="connection-line"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'

const itemRef = ref<HTMLElement>()

onMounted(() => {
  // 添加黑客风格的初始化日志
  console.log('[MODULE] WelcomeItem component initialized')
})
</script>

<style scoped>
/* 项目容器 */
.item {
  margin-top: 2rem;
  display: flex;
  position: relative;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--hacker-border);
  padding: 15px;
  border-radius: 4px;
  transition: all 0.3s ease;
  overflow: hidden;
}

/* 悬停效果 */
.item:hover {
  border-color: var(--hacker-green);
  box-shadow: 0 0 15px var(--hacker-green-glow);
  transform: translateY(-2px);
}

/* 详情区域 */
.details {
  flex: 1;
  margin-left: 1rem;
  position: relative;
  z-index: 2;
}

/* 图标容器 */
.icon-container {
  position: relative;
  display: flex;
  place-items: center;
  place-content: center;
  width: 32px;
  height: 32px;
  z-index: 2;
}

/* 图标发光效果 */
.icon-glow {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background-color: var(--hacker-green-glow);
  opacity: 0.2;
  border-radius: 50%;
  animation: pulse 2s infinite alternate;
}

/* 图标样式 */
i {
  display: flex;
  place-items: center;
  place-content: center;
  width: 32px;
  height: 32px;
  color: var(--hacker-green);
  position: relative;
  z-index: 3;
}

/* 黑客风格标题 */
.hacker-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.4rem;
  color: var(--hacker-green);
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  text-shadow: 0 0 5px var(--hacker-green-glow);
}

/* 内容样式 */
.content {
  color: var(--hacker-text);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
}

/* 连接线条 */
.connection-line {
  position: absolute;
  left: 16px;
  top: 100%;
  width: 2px;
  height: 2rem;
  background: linear-gradient(to bottom, var(--hacker-green), transparent);
  opacity: 0.5;
}

/* 最后一个项目没有连接线 */
.item:last-of-type .connection-line {
  display: none;
}

/* 动画效果 */
@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.2;
  }
  100% {
    transform: scale(1.2);
    opacity: 0.4;
  }
}

/* 桌面端样式 */
@media (min-width: 1024px) {
  .item {
    margin-top: 0;
    padding: 1.5rem 0 1.5rem calc(var(--section-gap) / 2);
    border-left: 2px solid var(--hacker-border);
    border-right: none;
    border-top: none;
    border-bottom: none;
    border-radius: 0;
    background: transparent;
  }
  
  .item:hover {
    border-left-color: var(--hacker-green);
  }
  
  .icon-container {
    top: calc(50% - 25px);
    left: calc(var(--section-gap) / -4);
    position: absolute;
    background-color: var(--hacker-panel-dark);
    border: 1px solid var(--hacker-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
  }
  
  .icon-glow {
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
  }
  
  i {
    width: 50px;
    height: 50px;
  }
  
  /* 连接线样式 */
  .item:before {
    content: '';
    border-left: 2px solid var(--hacker-border);
    position: absolute;
    left: 0;
    bottom: calc(50% + 25px);
    height: calc(50% - 25px);
    opacity: 0.5;
  }
  
  .item:after {
    content: '';
    border-left: 2px solid var(--hacker-border);
    position: absolute;
    left: 0;
    top: calc(50% + 25px);
    height: calc(50% - 25px);
    opacity: 0.5;
  }
  
  .item:hover:before,
  .item:hover:after {
    border-left-color: var(--hacker-green);
    opacity: 0.8;
  }
  
  .item:first-of-type:before {
    display: none;
  }
  
  .item:last-of-type:after {
    display: none;
  }
  
  /* 隐藏装饰线 */
  .connection-line {
    display: none;
  }
}

/* 链接样式 */
.content a {
  color: var(--hacker-green);
  text-decoration: none;
  border-bottom: 1px dashed var(--hacker-green);
  transition: all 0.3s ease;
  font-family: 'Courier New', monospace;
}

.content a:hover {
  color: var(--hacker-green-light);
  border-bottom-color: var(--hacker-green-light);
  text-shadow: 0 0 5px var(--hacker-green-glow);
}

/* 代码样式 */
.content code {
  background-color: rgba(0, 0, 0, 0.5);
  color: var(--hacker-green);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  border: 1px solid var(--hacker-border);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .item {
    margin-top: 1.5rem;
    padding: 12px;
  }
  
  .hacker-title {
    font-size: 1.1rem;
  }
  
  .content {
    font-size: 13px;
  }
}
</style>
